disk->backend_domid = 0;
disk->domid = domid;
- disk->physpath = NULL;
- disk->phystype = 0;
+ disk->physpath = strdup("");
+ disk->phystype = PHYSTYPE_EMPTY;
/* this value is returned to the user: do not free right away */
disk->virtpath = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/dev", backend));
disk->unpluggable = 1;
device.backend_kind = DEVICE_VBD;
break;
}
+ case PHYSTYPE_EMPTY:
+ break;
case PHYSTYPE_FILE:
/* let's pretend is tap:aio for the moment */
disk->phystype = PHYSTYPE_AIO;
pdisk->backend_domid = 0;
pdisk->domid = domid;
physpath_tmp = xs_read(ctx->xsh, XBT_NULL, libxl__sprintf(&gc, "%s/%s/params", be_path, *dir), &len);
- if (strchr(physpath_tmp, ':')) {
+ if (physpath_tmp && strchr(physpath_tmp, ':')) {
pdisk->physpath = strdup(strchr(physpath_tmp, ':') + 1);
free(physpath_tmp);
} else {
if (!disk->physpath) {
disk->physpath = strdup("");
- disk->phystype = PHYSTYPE_PHY;
+ disk->phystype = PHYSTYPE_EMPTY;
}
disks = libxl_device_disk_list(ctx, domid, &num);
for (i = 0; i < num; i++) {
case PHYSTYPE_AIO: return "aio";
case PHYSTYPE_FILE: return "file";
case PHYSTYPE_PHY: return "phy";
+ case PHYSTYPE_EMPTY: return "file";
default: return NULL;
}
}
case PHYSTYPE_AIO: return "tap";
/* let's pretend file is tap:aio */
case PHYSTYPE_FILE: return "tap";
+ case PHYSTYPE_EMPTY: return "tap";
case PHYSTYPE_PHY: return "phy";
default: return NULL;
}
return 0;
}
tok = p + 1;
+ } else if (*p == ',') {
+ state = DSTATE_VIRTPATH;
+ disk->phystype = PHYSTYPE_EMPTY;
+ disk->physpath = strdup("");
+ tok = p + 1;
}
break;
case DSTATE_TAP:
libxl_string_to_phystype(&ctx, phys, &disk.phystype);
}
} else {
- disk.physpath = NULL;
- disk.phystype = 0;
+ disk.physpath = strdup("");
+ disk.phystype = PHYSTYPE_EMPTY;
}
disk.virtpath = (char*)virtdev;
disk.unpluggable = 1;